/**
 * 
 */
$(function(){
	$('#batch_do').click(function(){
		var ac = $('#batch_select').val();
		var msg = (ac == 'delete')?'删除':' 不知干嘛';
		var sel = [];
		
		$('input[name="chk"]').each(function(i){
			if($(this).attr('checked')){
				sel.push($(this).val());
			}
		});
		if(sel.length>0){
			if(ac=='delete'){
				$h.confirm('真的要'+msg, function(m){
					if(m=='ok'){
						$h.load('/sysadmin/admins/'+ac+'/'+sel.join('-'),'', function(d){
							for(var i=0; i<sel.length; i++){
								$('#tr_'+sel[i]).remove();
							}
						});
					}
				});
			}
			
		}else{
			$h.alert('木有选择啊，亲');
		}
		return ;
	});
});

function del(id){
	$h.confirm('确认删除', function(msg){
		log.debug(msg);
		if(msg == 'ok'){
			log.debug($(this));
		
			$h.load('/sysadmin/admins/delete/'+id,'', function(d){
				$('#tr_'+id).remove();
				
			});
			return true;
		}else{
			return false;
		}		
		
	});
	
}